<include file="Public/header" />
<title></title>
</head>
<body>
<div class="page-container">
    <form class="form form-horizontal" id="form-article-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>计划入库单号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" disabled class="input-text" value="<{$result.order_no}>" placeholder=""  name="order_no">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">制单人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="<{$result.making}>" placeholder="" name="making">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">采购人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="<{$result.purchaser}>" placeholder="" name="purchaser">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">部门：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="<{$result.department}>" placeholder="" name="department">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">来往公司：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="<{$result.from_company}>" placeholder="" name="from_company">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">申请理由：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea style="max-height: 46px; min-height: 46px; " type="text" class="input-text" placeholder="" name="app_reasons"><{$result.app_reasons}></textarea>
            </div>
        </div>
		<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">账册编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select name="manua_id" class="select">
					<option value="0">请选择</option>
					<foreach name="book_list" item="vo">
						<option value="<{$vo.book_no}>" <if condition="$vo['book_no'] eq $result['manua_id']">selected</if> ><{$vo.name}></option>
					</foreach>
				</select>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button onClick="save('<{$result.id}>')" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                <button onClick="cancel()" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
<include file="Public/footer_js" />
<script>
    function save(id){
        $.post('__CONTROLLER__/editD',{
            id:id,
            order_no:"<{$result.order_no}>",
            purchaser:$("input[name=purchaser]").val(),
            making:$("input[name=making]").val(),
            department:$("input[name=department]").val(),
            from_company:$("input[name=from_company]").val(),
            app_reasons:$("textarea[name=app_reasons]").val(),
			manua_id:$("select[name=manua_id]").val(),
        },function (msg){
            layer.msg(msg.data);
            if(msg.flag==1){
                setTimeout(function (){
                    parent.layer.closeAll();
                    parent.location.reload();
                },800);
            }
        },'json');
    }
    function cancel(){
        parent.layer.closeAll();
    }
    ////////获取仓库编码
    $.get('__MODULE__/Warehouse/getWarehouse/'+"/"+Math.random(),{},function (msg){
        getWarehouse(msg.data);
    },'json');
    function getWarehouse(data){
        for(var m in data){
            if(data[m]['name']){
                if($("select[name=warehouse_code]").attr('tabindex')==data[m]['code']){
                    var ck="selected";
                }else{
                    var ck="";
                }
                var html='<option '+ck+' value="'+data[m]['code']+'">'+data[m]['name']+'</option>';
                $("select[name=warehouse_code]").append($(html));
            }
        }
    }
</script>
</body>
</html>